package com.baozhun.mall.common.widget.customview.addresspicker

import com.baozhun.mall.common.BR
import com.baozhun.mall.common.R
import com.baozhun.mall.common.base.BaseListAdapter
import com.baozhun.mall.common.databinding.ItemClassifyLayoutBinding
import com.baozhun.mall.common.databinding.ItemHotRegionBinding
import com.baozhun.mall.common.model.bean.ClassifyInfo
import com.baozhun.mall.common.model.bean.HotRegionBean
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder

/**
 * @Title：
 * @Description：
 * @Author：xing.luo
 * @Since：2022/12/19
 * @Version：1.0.0
 */
class UsefulCityAdapter(data: MutableList<HotRegionBean>?) :
    BaseListAdapter<HotRegionBean, ItemHotRegionBinding>(R.layout.item_hot_region, data) {

    override fun convert(holder: BaseDataBindingHolder<ItemHotRegionBinding>, item: HotRegionBean) {
        holder.dataBinding?.setVariable(BR.model, item.city)

        item.isSelect = (item.city == AddressPickerDialog.currentAddress?.province ||
                item.city == AddressPickerDialog.currentAddress?.street ||
                item.city == AddressPickerDialog.currentAddress?.county ||
                item.city == AddressPickerDialog.currentAddress?.city
                )
        holder.dataBinding?.hotRegionCity?.isSelected = item.isSelect
    }
}